home *** CD-ROM | disk | FTP | other *** search
- Path: rain.fr!world-net!usenet
- From: Martin Kerharo <kerharo@worldnet.fr>
- Newsgroups: comp.lang.c++
- Subject: Re: Question about destructor...
- Date: 3 Jan 1996 18:38:01 GMT
- Organization: World-Net information exchange, Internet provider.
- Message-ID: <4ceie9$jmi@aldebaran.sct.fr>
- References: <4ce9mk$atg@eng_ser1.erg.cuhk.hk>
- NNTP-Posting-Host: client108.sct.fr
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.1N (Macintosh; I; 68K)
- X-URL: news:4ce9mk$atg@eng_ser1.erg.cuhk.hk
-
- You ask :
- >So what should be written in the destructor of B so
- >that all the private members inherited from A are also "deleted"?
-
- You don't need to do anything : the destructor for "A" will be
- automatically called after the destructor for "B" has been called.
-
- It's the reversed system that is used for instance initialization :
- when you create an object, all its constructors are called, in your
- case the constructor for "A" being called before the destructor for
- "B", because "B" is derived from "A".
-
- When you destroy an object, all destructors are called, in the reverse
- order (destructor for "B" first, then destructor for "A").
-
- (At least I know the answer to one question ! I hope I didn't make any
- mistake...)
-
- --Martin
-
-
-